/**
 * @author zhengjiachao
 * @since 2017-4-16
 */
ADF.domControl.ControlMixin = {
    
    createDomElement: function(model) {
        this.domElement = this._getDomElement(model);
        this.setADFControlType();
        this.setADFTag(model.getADFTag());
        this.setADFID(model.getID());
        this.setBorder(model.getBorder());
        this.setColor(model.getColor());
        this.setBackground(model.getBackground());
        this.setFontsize(model.getFontsize());
        this.setTitle(model.getTitle());
        return this.domElement;
    },

    setBorder:function (border) {
        this.domElement.style.border = border;
    },

    setColor:function(color){
        this.domElement.style.color = color;
    },

    setBackground:function(bg){
        this.domElement.style.background = bg;
    },

    setFontsize:function(fontsize){
        this.domElement.style.fontSize = fontsize;
    },

    setTitle:function(title){
        this.domElement.title = title;
    },

    _getDomElement : Function.emptyFunction,

    setADFTag : function(tag){
        if(this.domElement){
            tag ? $(this.domElement).attr({'adftag' : tag}) : $(this.domElement).removeAttr('adftag');
        }
    },

    setADFID : function(id){
        if(this.domElement){
            id ? $(this.domElement).attr({'adfid' : id}) : $(this.domElement).removeAttr('adfid');
        }
    },

    setADFControlType : function(){
        var label = this.getLabel();
        if(this.domElement){
            $(this.domElement).attr({'ADF_Control_Type' : label});
        }
    }
};